<% support_page_header('manages_access', 'Global Admins') %>
<%= section_panel 'Global Admin Groups', :width => 'single' do %>
  <%= list(@groups,
           :toolbar  => {:list_name => 'group_list',
                         :sort_by   => [%w(Name name), %w(Created created)],
                         :filter_by => %w(name)}) do |builder, group| %>
    <% builder.itemid "group_#{group.id}" %>
    <% builder.attributes raw(%(name="#{group.name}" created="#{group.created_at}")) %>
    <% builder.target link_to('', edit_account_group_path(group), :remote => true) %>
    <% builder.top do %>
      <span class="topname"><%= group.name %></span>
      <span class="topdesc"><%= truncate(group.description, 20) if group.description.present? %></span>
    <% end %>
    <% builder.bottom raw("created #{time_ago_in_words(group.created_at)} by #{group.created_by}") %>
    <% builder.menu do %>
      <%= link_to(icon('times', 'Leave'), account_group_member_path(group, current_user.id), :method => :delete, :remote => true, :confirm => "Leave group #{group.name}?") %>
    <% end %>
  <% end %>
<% end %>
<div id="group_details"></div>
<div id="confirm_group_delete_modal"></div>
